

import 'package:cunyutech_flutter_ui/src/text/main.dart';
import 'package:cunyutech_flutter_ui/src/theme/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

import 'OverlaySupport.dart';

OverlayEntry showOverlayLoading({
  String title
}) {
  return showOverlay(
    builder: (BuildContext _, OverlaySupportState state) {
      var cs = state.colorSystem;
      final Widget pageChild = SpinKitFadingCircle(color: Colors.white);
      return Container(
        alignment: Alignment.center,
        color: Colors.transparent,
        child: Container(
          width: 128,
          height: 128,
          alignment: Alignment.center,
          decoration: BoxDecoration(
            color: Color(0xFF101214),
            borderRadius: BorderRadius.circular(CYBorderRadius.Large) 
          ),
          padding: EdgeInsets.symmetric(horizontal: CYMargin.Small),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              pageChild,
              title == null || title.isEmpty ? null : CYParagraph(title, color: cs.darkForeColorSystem.primaryColor, textAlign: TextAlign.center, alignment: Alignment.center, lineHeight: null, margin: EdgeInsets.only(top: CYMargin.Default),)
            ].where((item)=> item != null).toList()
          ),
        )
      );
    }
  );
}
